/* interface IPerson1 {
  name: string,
  age: string
}
interface IPerson2 {
  name: string,
  age: number
} */

// 泛型接口
/* interface IPerson<T> {
  name: string
  age: T
}
const p1: IPerson<string> = {
  name: 'ifer',
  age: '18'
}
const p2: IPerson<number> = {
  name: 'ifer',
  age: 18
} */

/* interface IdFunc<T> {
  id: () => T
  ids: () => T[]
}
const temp: IdFunc<string> = {
  id: () => 'abc',
  ids: () => ['a', 'b']
} */

// const arr: number[] = [1, 3, 5]
// 泛型的写法
// const arr: Array<number> = [1, 3, 5]
interface IArray<T> {
  // [key: number] 表示 key 是 number 类型，可以有任意多个
  [key: number]: T
}

const arr: IArray<number> = [1, 3, 5]
arr[0]
arr[1]

export { }
